package com.forlove.app.qselect.login.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.forlove.app.R;
import com.forlove.app.common.widget.dialog.AnimationType;

/**
 * Created by yjl on 2017/10/12.
 */

public class SetGpsDialog extends Dialog {
    private Window mWindow;
    private Context mContext;
    /**
     * 进入动画是windowAnimation windowAnimation定义在style中.
     */
    protected int[] mAnimations = {R.style.QYQ_Dialog_Animation_Fly,
            R.style.QYQ_Dialog_Animation_Fade,
            R.style.QYQ_Toast_Animation_Fly,
            R.style.QYQ_Toast_Animation_Fade,
            R.style.QYQ_Dialog_Animation_FlyInFadeOut,
            R.style.QYQ_Dialog_Animation_FlyInFlyOut,
            R.style.QYQ_Toast_Animation_FlyInFlyOut,
            R.style.QYQ_Toast_Animation_FlyTopInFlyTopOut};

    private TextView text_messeage;
    private TextView dialog_agree;
    private TextView title_need_permission;

    public SetGpsDialog(Context context) {
        super(context, R.style.showDialog);
        setContentView(R.layout.dialog_set_gps_tip_info);
        mWindow = getWindow();
        mContext = context;
        mWindow.setWindowAnimations(mAnimations[AnimationType.DIALOG_FADE.getValue()]);
        mWindow.setGravity(Gravity.CENTER);
        mWindow.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.bg_gray_corner));
        dialog_agree = (TextView) findViewById(R.id.dialog_agree);
        text_messeage = (TextView) findViewById(R.id.text_messeage);
        title_need_permission = findViewById(R.id.title_need_permission);
    }

    public void setTextMesseage(String textMesseage) {
        text_messeage.setText(textMesseage);
    }

    public void setAgreeListener(View.OnClickListener agreeListener) {
        this.dialog_agree.setOnClickListener(agreeListener);
    }

    public void setTitleMsg(String titleMsg) {
        title_need_permission.setText(titleMsg);
        title_need_permission.setVisibility(View.VISIBLE);
    }
}
